<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Electronix Store</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<link rel="stylesheet" type="text/css" href="style.css" />
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="iecss.css" />
<![endif]-->
<script type="text/javascript" src="js/boxOver.js"></script>

<script type="text/javascript"  language="javascript">
    var request;
    function addToCart(productId){
        if(window.XMLHttpRequest()){
            request = new XMLHttpRequest();
        }else{
            request = new ActiveXObject("Microsoft.XMLHTTP");
        }
        var url = "ProductServlet?action=purchase&productId=" + productId;
        //                alert(url)
        var method = "GET";
        request.open(method,url,false);
        request.onreadystatechange = callbackCart;

        request.send();
    }
    function getProducts(categoryId,pageIndex){
        if(window.XMLHttpRequest()){
            request = new XMLHttpRequest();
        }else{
            request = new ActiveXObject("Microsoft.XMLHTTP");
        }
        var url = "ProductServlet?action=product&categoryId="+categoryId+"&page=" + pageIndex;
        //                alert(url)
        var method = "GET";
        request.open(method,url,false);
        request.onreadystatechange = callback;

        request.send(null);
    }
    function getProduct(categoryId){

        if(window.XMLHttpRequest()){
            request = new XMLHttpRequest();
        }else{
            request = new ActiveXObject("Microsoft.XMLHTTP");
        }
        var url = "ProductServlet?action=product&categoryId="+categoryId;
        //                alert(url)
        var method = "GET";
        request.open(method,url,false);
        request.onreadystatechange = callback;

        request.send(null);
    }
    function get(){
        alert(window.location.href);
        if(window.XMLHttpRequest()){
            request = new XMLHttpRequest();
        }else{
            request = new ActiveXObject("Microsoft.XMLHTTP");
        }
        var url = "ProductServlet?action=product";

        var method = "GET";
        request.open("GET",url,false);
        request.onreadystatechange = callback;

        request.send(null);
    }
    function callback(){
        if(request.readyState == 4){
            if(request.status == 200){
                var z = document.getElementById('center_content')
               
                z.innerHTML= request.responseText
            }else{
                z.innerHTML = "An error has occured. respose status != 200."
            }
        }else{
            z.innerHTML = "An error has occured. ready State != 4."
        }

    }
    function callbackCart(){
        if(request.readyState == 4){
            if(request.status == 200){
                var z = document.getElementById('right_content')
                z.innerHTML= request.responseText
            }else{
                z.innerHTML = "An error has occured. respose status != 200."
            }
        }else{
            z.innerHTML = "An error has occured. ready State != 4."
        }
    }
</script>